﻿//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Pantalla de inicio con el boton de START y la CARATULA
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

using UnityEngine;
using System.Collections;

public class GUIMain : MonoBehaviour
{
	public GUISkin mSkin;
	public Texture texLogo;

	Rect rectTexLogo;
	Rect rectStart;

	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	void Awake()
	{
		ButtonProps.Init();
	}

	void Start()
	{
		//Calculate size and position for background textures and progress bar
		float originalW = 500;
		float originalH = 700;
		float ratio = originalW/originalH;
		float targetW = Screen.width*0.8f;
		float targetH = targetW/ratio;
		float x = (Screen.width-targetW)/2.0f;
		float y = (Screen.height-targetH)*0.1f;

		rectTexLogo = new Rect(x,y,targetW,targetH);

		rectStart = new Rect(Screen.width/2-ButtonProps.buttonSize/2, Screen.height-ButtonProps.buttonSize*2, ButtonProps.buttonSize, ButtonProps.buttonSize);
	}

	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	void OnGUI()
	{
		GUI.skin = mSkin;

		GUI.DrawTexture(rectTexLogo, texLogo);

		if(GUI.Button(rectStart, "", "start")){
			Application.LoadLevel("01 Select Char");
		}
	}
}
